home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_weap_zippo.cog < prev    next >
Text File  |  1999-11-15  |  3KB  |  166 lines

  1. # Jones 3D Cog Script
  2. #
  3. # weap_Zippo.cog
  4. #
  5. # This cog controls Indy's trusty Zippo lighter.
  6. #
  7. # [RandyT]
  8. #
  9. # (C) 1998 LucasArts Entertainment Company LLC. All Rights Reserved
  10. #
  11. # ===================================================================
  12.  
  13. symbols
  14.  
  15. message        startup
  16. message        fire
  17. message        activated
  18. message        deactivated
  19. message        selected
  20. message        deselected
  21. message        callback
  22. message        pulse
  23.  
  24. material    mat=gen_a4sfx_lighterglow.mat    local    # Autoloaded
  25.  
  26. model        lighter=hand_in_ziplit.3do        local    # Autoloaded
  27.  
  28. sound        open=gen_zippo_open.wav            local    # Autoloaded
  29. sound        close=gen_zippo_close.wav        local    # Autoloaded
  30.  
  31. template    glow=zippo_glow                    local    # Autoloaded
  32.  
  33. thing        player                            local
  34. thing        spriteThing                        local
  35.  
  36. int            handMesh                        local
  37. int            callNum                            local
  38. int            swapRef                            local
  39. int            lightAnim                        local
  40.  
  41. int            oldCell=1                        local
  42. int            newCell=0                        local
  43.  
  44. end
  45.  
  46. # ===================================================================
  47.  
  48. code
  49.  
  50. startup:
  51.  
  52.     player = GetLocalPlayerThing();
  53.     handMesh = GetMeshByName(player, "inrhand");
  54.  
  55.     return;
  56.  
  57. # -------------------------------------------------------------------
  58.  
  59. fire:
  60.  
  61.     SetFireWait(player, 2.0);
  62.     return;
  63.  
  64. # -------------------------------------------------------------------
  65.  
  66. activated:
  67.  
  68.     SetAimWait(player, 0.0);
  69.     SetFireWait(player, 0.0);
  70.     ActivateWeapon(player, 2.0);
  71.  
  72.     return;
  73.  
  74. # -------------------------------------------------------------------
  75.  
  76. deactivated:
  77.  
  78.     DeactivateWeapon(player);
  79.     return;
  80.  
  81. # -------------------------------------------------------------------
  82.  
  83. selected:
  84.  
  85.     SetMountWait(player, 1.0);
  86.  
  87.     SetArmedMode(player, 7);
  88.     SetCurWeapon(player, 13);
  89.  
  90.     CaptureThing(player);
  91.     PlayMode(player, 68, 0);
  92.  
  93.     return;
  94.  
  95. # -------------------------------------------------------------------
  96.  
  97. deselected:
  98.  
  99.     SetMountWait(player, 1.0);
  100.     StopMode(player, 68, 0);
  101.  
  102.     CaptureThing(player);
  103.     PlayMode(player, 67, 0);
  104.  
  105.     PlaySoundThing(close, player, 1, -1, -1, 0x880);
  106.  
  107.     SetArmedMode(player, 0);
  108.  
  109.     return;
  110.  
  111. # -------------------------------------------------------------------
  112.  
  113. callback:
  114.  
  115.     callNum = GetParam(1);
  116.  
  117.     # Pull lighter
  118.     if (callNum == 28)
  119.     {
  120.         SetWeaponModel(player, 13);
  121.     }
  122.     # Put lighter
  123.     else if (callNum == 29)
  124.     {
  125.         ReleaseThing(player);
  126.         ResetWeaponModel(player);
  127.     }
  128.     # Create & attach sprite
  129.     else if (callNum == 30)
  130.     {
  131.            ReleaseThing(player);
  132.         PlaySoundThing(open, player, 1, -1, -1, 0x880);
  133.         swapRef = SetThingMesh(player, handMesh, lighter, 0);
  134.         spriteThing = AttachThingToThingMesh(player, glow, handMesh);
  135.         # 0.855 0.6 0.4    0.6
  136.         lightAnim = ThingLightAnim(spriteThing, '0.825 0.57 0.37', 0.6, '0.885 0.63 0.43', 0.6, 0.75);
  137.         SetPulse(0.125);
  138.     }
  139.     # Destroy sprite
  140.     else if (callNum == 31)
  141.     {
  142.         StopAnim(lightAnim);
  143.         RestoreThingMesh(player, swapRef);
  144.         DetachThingMesh(spriteThing);
  145.         SetPulse(0);
  146.     }
  147.     
  148.     return;
  149.  
  150. # -------------------------------------------------------------------
  151.  
  152. pulse:
  153.  
  154.     # Pick 1 of 4 possible random frames...no repeats
  155.     while (newCell == oldCell) 
  156.     {
  157.         newCell = RandBetween(0, 3);
  158.     }
  159.  
  160.     oldCell = newCell;
  161.     SetMaterialCel(mat, newCell);
  162.  
  163.     return;
  164.  
  165. end
  166.